package com.prs.crm.domain.official;

import java.util.Date;
import java.util.List;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.dao.official.PersonalMailDao;
import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.BaseEntity;
/***
 * 
 * @author Yanghao
 *	2012-8-29 14:49:56 个人邮件
 */
@Entity
@Table(name="official_personalmail")
public class PersonalMail extends BaseEntity{

	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer id;
	private String title;
	private String mailType;
	@ManyToOne
	private PersonalMailNum personalMailNum;
	@ManyToOne
	private PersonalMailAutograph personalMailAutograph;
	private String receivePerson;
	private String receivePerosnId;
	
	private String copyToPerson;
	private String copyToPersonId;
	
	private String bccPerson;
	private String bccPersonId;
	@Lob
	private String content;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private Attachment attach;
	/**1已发送，2,草稿箱,3已删除文件*/
	private Integer type;
	private String lastPerson;
	private Date lastTime;
	private Date updateTime;
	/**已收邮件*/
//	@OneToMany(fetch=FetchType.LAZY,mappedBy="personalMail")
//	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
//	private Set<PersonalMailReceive> personalMailReceive;
	
	private Integer comment;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="personalMail")
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private List<PersonalMailComment> personalMailComment;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="personalMail")
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private Set<PersonMailDel> personMailDel;

	public Set<PersonMailDel> getPersonMailDel() {
		return personMailDel;
	}

	public void setPersonMailDel(Set<PersonMailDel> personMailDel) {
		this.personMailDel = personMailDel;
	}

	public Integer getComment() {
		return comment;
	}

	public void setComment(Integer comment) {
		this.comment = comment;
	}

	public List<PersonalMailComment> getPersonalMailComment() {
		return personalMailComment;
	}

	public void setPersonalMailComment(List<PersonalMailComment> personalMailComment) {
		this.personalMailComment = personalMailComment;
	}

	public PersonalMailNum getPersonalMailNum() {
		return personalMailNum;
	}

	public void setPersonalMailNum(PersonalMailNum personalMailNum) {
		this.personalMailNum = personalMailNum;
	}

	public PersonalMailAutograph getPersonalMailAutograph() {
		return personalMailAutograph;
	}

	public void setPersonalMailAutograph(PersonalMailAutograph personalMailAutograph) {
		this.personalMailAutograph = personalMailAutograph;
	}

//	public Set<PersonalMailReceive> getPersonalMailReceive() {
//		return personalMailReceive;
//	}
//
//	public void setPersonalMailReceive(Set<PersonalMailReceive> personalMailReceive) {
//		this.personalMailReceive = personalMailReceive;
//	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getLastPerson() {
		return lastPerson;
	}

	public void setLastPerson(String lastPerson) {
		this.lastPerson = lastPerson;
	}

	public Date getLastTime() {
		return lastTime;
	}

	public void setLastTime(Date lastTime) {
		this.lastTime = lastTime;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getMailType() {
		return mailType;
	}

	public void setMailType(String mailType) {
		this.mailType = mailType;
	}

	public String getReceivePerson() {
		return receivePerson;
	}

	public void setReceivePerson(String receivePerson) {
		this.receivePerson = receivePerson;
	}

	public String getReceivePerosnId() {
		return receivePerosnId;
	}

	public void setReceivePerosnId(String receivePerosnId) {
		this.receivePerosnId = receivePerosnId;
	}

	public String getCopyToPerson() {
		return copyToPerson;
	}

	public void setCopyToPerson(String copyToPerson) {
		this.copyToPerson = copyToPerson;
	}

	public String getCopyToPersonId() {
		return copyToPersonId;
	}

	public void setCopyToPersonId(String copyToPersonId) {
		this.copyToPersonId = copyToPersonId;
	}

	public String getBccPerson() {
		return bccPerson;
	}

	public void setBccPerson(String bccPerson) {
		this.bccPerson = bccPerson;
	}

	public String getBccPersonId() {
		return bccPersonId;
	}

	public void setBccPersonId(String bccPersonId) {
		this.bccPersonId = bccPersonId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Attachment getAttach() {
		return attach;
	}

	public void setAttach(Attachment attach) {
		this.attach = attach;
	}
}
